<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui" >

<head>

</head>
<body>


	<ui:composition template="../WEB-INF/layout/template.xhtml">
		<ui:define name="title"><h:outputText value="#{msg.add_student}" /></ui:define>
		<ui:define name="content">
		
		<p:growl id="growl"/>
		
		<h:form id="studentForm">

			<p:panel header="#{msg.student_details}">

				<h:panelGrid columns="4">
					<h:panelGroup>
						<h:outputText value="#{msg.first_name}"/><br/>
						<p:inputText id="firstname" value="#{inserisciStudenteBean.studentInput.firstName}" validator="genericNameValidator" required="true" size="15"/><br/>
						<p:message for="firstname"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.surname}"/><br/>
						<p:inputText id="surname" value="#{inserisciStudenteBean.studentInput.surname}"  validator="genericNameValidator" required="true" size="15"/><br/>
						<p:message for="surname"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.citizenship}"/><br/>
						<p:inputText id="cit" value="#{inserisciStudenteBean.studentInput.citizenship}" required="true" size="15"/><br/>
						<p:message for="cit"/>
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{msg.passport_number}"/><br/>
						<p:inputText id="pass" value="#{inserisciStudenteBean.studentInput.passportNumber}" validator="alphaNumericValidator" required="false" size="15"/><br/>
						<p:message for="pass"/>
					</h:panelGroup>
				</h:panelGrid>
				
				<h:panelGrid columns="2">
					<p:dataTable value="#{inserisciStudenteBean.studentInput.emails}" var="email">
						<f:facet name="header">
							#{msg.emails}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.email}
							</f:facet>
							<p:inputText id="email" value="#{email.email}" validator="emailValidator" required="true" size="25"/><br/>
							<p:message for="email"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.type}
							</f:facet>
							<h:selectOneMenu value="#{email.type}">
								<f:selectItems value="#{inserisciStudenteBean.emailTypeOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciStudenteBean.studentInput.removeEmail}" update="studentForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{email}" target="#{inserisciStudenteBean.studentInput.emailToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" actionListener="#{inserisciStudenteBean.studentInput.addEmptyEmail}" update="studentForm growl msgs"/>
						</f:facet>
					</p:dataTable>					
							
					<p:dataTable value="#{inserisciStudenteBean.studentInput.telephones}" var="phone">
						<f:facet name="header">
							#{msg.phones}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.number}
							</f:facet>
							<p:inputText id="number" value="#{phone.number}" validator="telefonoValidator" required="true" size="15"/><br/>
							<p:message for="number"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.type}
							</f:facet>
							<h:selectOneMenu value="#{phone.type}">
								<f:selectItems value="#{inserisciStudenteBean.phoneTypeOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.country}
							</f:facet>
							<h:selectOneMenu value="#{phone.country}">
								<f:selectItems value="#{inserisciStudenteBean.phoneCountryOptions}"/>
							</h:selectOneMenu>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciStudenteBean.studentInput.removeTelephone}" update="studentForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{phone}" target="#{inserisciStudenteBean.studentInput.phoneToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" actionListener="#{inserisciStudenteBean.studentInput.addEmptyPhone}" update="studentForm growl msgs"/>
						</f:facet>
					</p:dataTable>	
			</h:panelGrid>
			
			<h:panelGrid columns="1">
					<p:dataTable value="#{inserisciStudenteBean.studentInput.indirizziIt}" var="indit">
						<f:facet name="header">
							#{msg.residence_addresses}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.address_line_1}
							</f:facet>
							<p:inputText id="addr1" value="#{indit.indirizzoLinea1}" size="25" required="true"/><br/>
							<p:message for="addr1"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.town}
							</f:facet>
							<p:inputText id="town" value="#{indit.citta}" size="15" required="true"/><br/>
							<p:message for="town"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.province}
							</f:facet>
							<p:inputText id="prov" value="#{indit.provincia}" size="15" required="true"/><br/>
							<p:message for="prov"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.country}
							</f:facet>
							<p:inputText id="country" value="#{indit.paese}" size="15" required="true"/><br/>
							<p:message for="country"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.cap}
							</f:facet>
							<p:inputText id="cap" value="#{indit.cap}" validator="capValidator" size="5" required="true"/><br/>
							<p:message for="cap"/>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciStudenteBean.studentInput.removeIndIt}" update="studentForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{indit}" target="#{inserisciStudenteBean.studentInput.indItToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" action="#{inserisciStudenteBean.studentInput.addEmptyIndIt}" update="studentForm growl msgs"/>
						</f:facet>
					</p:dataTable>
				
					<p:dataTable value="#{inserisciStudenteBean.studentInput.indirizziAu}" var="indau">
						<f:facet name="header">
							#{msg.australian_addresses}
						</f:facet>
						<p:column>
							<f:facet name="header">
								#{msg.address_line_1}
							</f:facet>
							<p:inputText id="addr1" value="#{indau.indirizzoLinea1}" size="25" required="true"/><br/>
							<p:message for="addr1"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.town}
							</f:facet>
							<p:inputText id="town" value="#{indau.citta}" size="15" required="true"/><br/>
							<p:message for="town"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.state}
							</f:facet>
							<h:selectOneMenu id="state" value="#{indau.stato}">
								<f:selectItems value="#{inserisciStudenteBean.stateOptions}"/>
							</h:selectOneMenu>
							<p:message for="state"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.country}
							</f:facet>
							<p:inputText id="country" value="#{indau.paese}" size="15" required="true"/><br/>
							<p:message for="country"/>
						</p:column>
						<p:column>
							<f:facet name="header">
								#{msg.post_code}
							</f:facet>
							<p:inputText id="postcode" value="#{indau.postCode}" validator="postCodeValidator" size="5" required="true"/><br/>
							<p:message for="postcode"/>
						</p:column>
						<p:column>
							<p:commandButton value="X" action="#{inserisciStudenteBean.studentInput.removeIndAu}" update="studentForm msgs growl" process="@this">
								<f:setPropertyActionListener value="#{indau}" target="#{inserisciStudenteBean.studentInput.indAuToRemove}" />
							</p:commandButton>
						</p:column>
						<f:facet name="footer">
							<p:commandButton value="+" action="#{inserisciStudenteBean.studentInput.addEmptyIndAu}" update="studentForm growl msgs"/>
						</f:facet>
					</p:dataTable>		
			</h:panelGrid>
			
			</p:panel>
			
			<p>
				<p:panel header="#{msg.arrival_and_departure_information}">
					<h:panelGrid columns="8">
						<h:panelGroup>
							<h:outputText value="#{msg.arrival_date}"/><br/>
							<p:calendar value="#{inserisciStudenteBean.studentInput.stayDetails.arrivalDate}" size="10"/>
						</h:panelGroup>
						<h:panelGroup>
							<br></br>
							<h:selectOneMenu value="#{inserisciStudenteBean.studentInput.stayDetails.arrivalDateAssumption}">
								<f:selectItem itemValue="true" itemLabel="#{msg.actual}"/>
								<f:selectItem itemValue="false" itemLabel="#{msg.alleged}"/>
							</h:selectOneMenu>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.town}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.stayDetails.arrivalTown}" size="10"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.state}"/><br/>
							<h:selectOneMenu value="#{inserisciStudenteBean.studentInput.stayDetails.arrivalState}">
								<f:selectItems value="#{inserisciStudenteBean.stateOptions}"/>
							</h:selectOneMenu>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.departure_date}"/><br/>
							<p:calendar value="#{inserisciStudenteBean.studentInput.stayDetails.departureDate}" size="10"/>
						</h:panelGroup>
						<h:panelGroup>
							<br></br>
							<h:selectOneMenu value="#{inserisciStudenteBean.studentInput.stayDetails.departureDateAssumption}">
								<f:selectItem itemValue="true" itemLabel="#{msg.actual}"/>
								<f:selectItem itemValue="false" itemLabel="#{msg.alleged}"/>
							</h:selectOneMenu>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.town}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.stayDetails.departureTown}" size="10"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.state}"/><br/>
							<h:selectOneMenu value="#{inserisciStudenteBean.studentInput.stayDetails.departureState}">
								<f:selectItems value="#{inserisciStudenteBean.stateOptions}"/>
							</h:selectOneMenu>
						</h:panelGroup>
					</h:panelGrid>
				</p:panel>
			</p>

			<p>
				<p:panel header="#{msg.visa_type}">
					<h:panelGrid columns="6">
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.whv}" label="Working Holiday Visa"/>Working Holiday Visa<br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.touristVisa}" label="Tourist Visa"/>Tourist Visa
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.whvNote}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.touristVisaNote}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.studentVisa}" label="Student Visa"/>Student Visa<br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.sponsorVisa}" label="Sponsor Visa"/>Sponsor Visa
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.studentVisaNote}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.sponsorVisaNote}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.skilledVisa}" label="Skilled Visa"/>Skilled Visa
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.skilledVisaNote}"/>
						</h:panelGroup>
					</h:panelGrid>
				</p:panel>
			</p>
			
			<p>
				<p:panel header="#{msg.interested_service_type}">
					<h:panelGrid columns="6">
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.englishCourse}" label="#{msg.english_course}"/>#{msg.english_course}<br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.professionalCourse}" label="#{msg.professional_course}"/>#{msg.professional_course}
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.englishCourseNote}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.professionalCourseNote}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.migrationAgent}" label="#{msg.migration_agent}"/>#{msg.migration_agent}<br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.insurance}" label="#{msg.insurance}"/>#{msg.insurance}
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.migrationAgentNote}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.insuranceNote}"/>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.type}"/><br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.translations}" label="#{msg.translations}"/>#{msg.translations}<br/>
							<h:selectBooleanCheckbox value="#{inserisciStudenteBean.studentInput.bankAccount}" label="#{msg.bank_account}"/>#{msg.bank_account}
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{msg.notes}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.translationsNote}"/><br/>
							<p:inputText value="#{inserisciStudenteBean.studentInput.bankAccountNote}"/>
						</h:panelGroup>
					</h:panelGrid>			
				</p:panel>
			</p>
			
			<p>
				<p:panel header="#{msg.emergency_contacts}" toggleable="true" toggleSpeed="100">
					<ui:repeat value="#{inserisciStudenteBean.studentInput.contattiDiEmergenza}" var="contact">
						<h:panelGrid columns="2">
							<p:panel header="#{msg.generalities}" toggleable="true" toggleSpeed="100">
			
								<h:panelGrid columns="5">
									<h:panelGroup>
										<h:outputText value="#{msg.first_name}"/><br/>
										<p:inputText id="firstname" value="#{contact.firstName}"  validator="genericNameValidator" required="true" size="15"/><br/>
										<p:message for="firstname"/>
									</h:panelGroup>
									<h:panelGroup>
										<h:outputText value="#{msg.surname}"/><br/>
										<p:inputText id="surname" value="#{contact.surname}"  validator="genericNameValidator" required="true" size="15"/><br/>
										<p:message for="surname"/>
									</h:panelGroup>
									<h:panelGroup>
										<h:outputText value="#{msg.citizenship}"/><br/>
										<p:inputText id="cit" value="#{contact.citizenship}" required="true" size="15"/><br/>
										<p:message for="cit"/>
									</h:panelGroup>
									<h:panelGroup>
										<h:outputText value="#{msg.passport_number}"/><br/>
										<p:inputText id="pass" value="#{contact.passportNumber}" validator="alphaNumericValidator" required="false" size="15"/><br/>
										<p:message for="pass"/>
									</h:panelGroup>
									<h:panelGroup>
										<h:outputText value="#{msg.type_of_relation}"/><br/>
										<p:inputText id="rel" value="#{contact.relazione}" required="true" size="15"/><br/>
										<p:message for="rel"/>
									</h:panelGroup>
								</h:panelGrid>
					
								<h:panelGrid columns="2">
									<p:dataTable value="#{contact.emails}" var="email">
										<f:facet name="header">
											#{msg.emails}
										</f:facet>
										<p:column>
											<f:facet name="header">
												#{msg.email}
											</f:facet>
											<p:inputText id="email" value="#{email.email}" validator="emailValidator" required="true" size="25"/><br/>
											<p:message for="email"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.type}
											</f:facet>
											<h:selectOneMenu value="#{email.type}">
												<f:selectItems value="#{inserisciStudenteBean.emailTypeOptions}"/>
											</h:selectOneMenu>
										</p:column>
										<p:column>
											<p:commandButton value="X" action="#{contact.removeEmail}" update="studentForm msgs growl" process="@this">
												<f:setPropertyActionListener value="#{email}" target="#{contact.emailToRemove}" />
											</p:commandButton>
										</p:column>
										<f:facet name="footer">
											<p:commandButton value="+" actionListener="#{contact.addEmptyEmail}" update="studentForm growl msgs"/>
										</f:facet>
									</p:dataTable>
					
									<p:dataTable value="#{contact.telephones}" var="phone">
										<f:facet name="header">
											#{msg.phones}
										</f:facet>
										<p:column>
											<f:facet name="header">
												#{msg.number}
											</f:facet>
											<p:inputText id="number" value="#{phone.number}" validator="telefonoValidator" required="true" size="15"/><br/>
											<p:message for="number"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.type}
											</f:facet>
											<h:selectOneMenu value="#{phone.type}">
												<f:selectItems value="#{inserisciStudenteBean.phoneTypeOptions}"/>
											</h:selectOneMenu>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.country}
											</f:facet>
											<h:selectOneMenu value="#{phone.country}">
												<f:selectItems value="#{inserisciStudenteBean.phoneCountryOptions}"/>
											</h:selectOneMenu>
										</p:column>
										<p:column>
											<p:commandButton value="X" action="#{contact.removeTelephone}" update="studentForm msgs growl" process="@this">
												<f:setPropertyActionListener value="#{phone}" target="#{contact.phoneToRemove}" />
											</p:commandButton>
										</p:column>
										<f:facet name="footer">
											<p:commandButton value="+" actionListener="#{contact.addEmptyPhone}" update="studentForm growl msgs"/>
										</f:facet>
									</p:dataTable>						
							</h:panelGrid>
				
								<h:panelGrid columns="1">
									<p:dataTable value="#{contact.indirizziIt}" var="indit">
										<f:facet name="header">
											#{msg.residence_addresses}
										</f:facet>
										<p:column>
											<f:facet name="header">
												#{msg.address_line_1}
											</f:facet>
											<p:inputText id="addr1" value="#{indit.indirizzoLinea1}" size="25" required="true"/><br/>
											<p:message for="addr1"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.town}
											</f:facet>
											<p:inputText id="town" value="#{indit.citta}" size="15" required="true"/><br/>
											<p:message for="town"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.province}
											</f:facet>
											<p:inputText id="prov" value="#{indit.provincia}" size="15" required="true"/><br/>
											<p:message for="prov"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.country}
											</f:facet>
											<p:inputText id="country" value="#{indit.paese}" size="15" required="true"/><br/>
											<p:message for="country"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.cap}
											</f:facet>
											<p:inputText id="cap" value="#{indit.cap}" validator="capValidator" size="5" required="true"/><br/>
											<p:message for="cap"/>
										</p:column>
										<p:column>
											<p:commandButton value="X" action="#{contact.removeIndIt}" update="studentForm msgs growl" process="@this">
												<f:setPropertyActionListener value="#{indit}" target="#{contact.indItToRemove}" />
											</p:commandButton>
										</p:column>
										<f:facet name="footer">
											<p:commandButton value="+" action="#{contact.addEmptyIndIt}" update="studentForm growl msgs"/>
										</f:facet>
									</p:dataTable>
					
									<p:dataTable value="#{contact.indirizziAu}" var="indau">
										<f:facet name="header">
											#{msg.australian_addresses}
										</f:facet>
										<p:column>
											<f:facet name="header">
												#{msg.address_line_1}
											</f:facet>
											<p:inputText id="addr1" value="#{indau.indirizzoLinea1}" size="25" required="true"/><br/>
											<p:message for="addr1"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.town}
											</f:facet>
											<p:inputText id="town" value="#{indau.citta}" size="15" required="true"/><br/>
											<p:message for="town"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.state}
											</f:facet>
											<h:selectOneMenu id="state" value="#{indau.stato}">
												<f:selectItems value="#{inserisciStudenteBean.stateOptions}"/>
											</h:selectOneMenu>
											<p:message for="state"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.country}
											</f:facet>
											<p:inputText id="country" value="#{indau.paese}" size="15" required="true"/><br/>
											<p:message for="country"/>
										</p:column>
										<p:column>
											<f:facet name="header">
												#{msg.post_code}
											</f:facet>
											<p:inputText id="postcode" value="#{indau.postCode}" validator="postCodeValidator" size="5" required="true"/><br/>
											<p:message for="postcode"/>
										</p:column>
										<p:column>
											<p:commandButton value="X" action="#{contact.removeIndAu}" update="studentForm msgs growl" process="@this">
												<f:setPropertyActionListener value="#{indau}" target="#{contact.indAuToRemove}" />
											</p:commandButton>
										</p:column>
										<f:facet name="footer">
											<p:commandButton value="+" action="#{contact.addEmptyIndAu}" update="studentForm growl msgs"/>
										</f:facet>
									</p:dataTable>
								</h:panelGrid>

							</p:panel>
							<p:commandButton value="X" action="#{inserisciStudenteBean.studentInput.removeEmergencyContact}" update="studentForm growl msgs" process="@this">
								<f:setPropertyActionListener value="#{contact}" target="#{inserisciStudenteBean.studentInput.emergencyContactToRemove}" />
							</p:commandButton>
						</h:panelGrid>
					</ui:repeat>
					<f:facet name="footer">
						<p:commandButton value="+" action="#{inserisciStudenteBean.studentInput.addEmptyEmergencyContact}" update="studentForm growl msgs"/>
					</f:facet>
				</p:panel>
			</p>
			
			<p>
				<center>
					<p:commandButton value="#{msg.submit}" action="#{inserisciStudenteBean.submit}" update="studentForm growl msgs"/>
				</center>
			</p>
			
			<p:messages id="msgs"/>
			
			</h:form>
			
		</ui:define>
	</ui:composition>



</body>
</html>
